#include "includes.h"

int main (int argc, char *argv[])
{
  board myBoard;
  std::list<Move> moveList;
  std::list<Move>::const_iterator moveIterator;
  int choice = 0;

  debug(1, "entering main()");

  srand(time(0));
  newBoard(&myBoard);
  
  while(!isGameOver(&myBoard))
  {
		printf("\n");
    printBoard(&myBoard);

    if (myBoard.onMove == BLACK)
      moveList = generateBlackMoves(&myBoard);
    else
      moveList = generateWhiteMoves(&myBoard);

    choice = rand() % moveList.size();

		moveIterator = moveList.begin();
    for (int i = 0; i < choice; i++)
		{
      moveIterator++;    
		}
  
    move(&myBoard, (*moveIterator));
		moveList.clear();
  }

	printf("\n");
  printBoard(&myBoard);

  debug(1, "exiting main()");

  return 0;
}

